<?php
/**
 * Joomla! 1.5 component JoomGPSTracks
 *
 * @version $Id: view.html.php 2009-06-24 15:40:19 svn $
 * @author Michael Pfister
 * @package joomGPStracks
 * @subpackage frontend
 * @license GNU/GPL
 * @filesource
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');


/**
 * HTML View class for the JoomGPSTracks component
 */
class JoomgpstracksViewJoomgpstracks extends JView {
	function display($tpl = null) {
        $cfg = joomgpstracksHelper::getConfig();

        $gps = new gpsClass();

        $document =& JFactory::getDocument();
        $document->addScript('http://www.google.com/jsapi?key='.$cfg->apikey);
        $document->addScript('http://www.google.com/uds/api?file=uds.js&v=1.0&key='.$cfg->apikey);
//        $document->addScript('http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css');
        
        $lh = layoutHelper::navigation();
        $footer = layoutHelper::footer();
        $model = $this->getModel();
        $rows = $model->getTracksData(NULL,NULL);
        $limit = "LIMIT 0," . $cfg->sort;
        $newest = $model->getTracksData("ORDER BY a.id DESC", $limit);
        $hits = $model->getTracksData("ORDER BY a.hits DESC", $limit);
        $cats = $model->getCatsData();
        
        $this->assignRef('lh',  $lh);
        $this->assignRef('footer',  $footer);
        $this->assignRef('gps', $gps);
        $this->assignRef('rows',    $rows);
        $this->assignRef('karte',    $karte);
        $this->assignRef('cats',    $cats);
        $this->assignRef('newest',    $newest);
        $this->assignRef('cfg',     $cfg);
        $this->assignRef('hits',    $hits);
        
        parent::display($tpl);
    }
}
?>